import requests
from urllib3.util import url
import app
from utils import get_url


class UesrApi(object):
    url = get_url('user_url')

    @classmethod
    def send_add_user(cls, json):
        resp = requests.post(cls.url, json=json, headers=app.HEADERS)
        return resp

    @classmethod
    def send_query_user(cls, emp_id):
        resp = requests.get(cls.url + '/' + emp_id, headers=app.HEADERS)
        return resp

    @classmethod
    def send_modify_user(cls, emp_id, json):
        resp = requests.put(cls.url + '/' + emp_id, json=json, headers=app.HEADERS)
        return resp

    @classmethod
    def send_del_user(cls, emp_id):
        resp = requests.get(cls.url + '/' + emp_id, headers=app.HEADERS)
        return resp
